import axios from 'axios';
axios.defaults.baseURL =process.env.NODE_ENV === "development" || process.env.NODE_ENV === "preview"
? "index.php/"
: location.href.match(/(\S*)views/)[1] + "index.php/",
axios.defaults.withCredentials = false;
export const isDev = false;

//拖拽提交
export const dragSave = params => { return axios.post( '/channel/drag/drag-save',params).then(res => res) };
//拖拽获取
export const getDragInfo = params => { return axios.get( '/channel/drag/get-drag-info',{params:params}).then(res => res) };
//图片上传分组
export const getCategory = params => { return axios.get( '/common/file/get-category',{params:params}).then(res => res) };
//获取图片数量
export const getPicture = params => { return axios.get( '/common/file/get-picture',{params:params}).then(res => res) };
//新增分组
export const saveCategory = params => { return axios.post( '/common/file/save-category',params).then(res => res) };
//删除分组
export const delCategory = params => { return axios.post( '/common/file/del-picture-category',params).then(res => res) };
//图片上传
export const uploadImage = params => { return axios.post( '/common/file/upload',params).then(res => res) };
//删除图片
export const delPicture = params => { return axios.post( '/common/file/del-picture',params).then(res => res) };
//商品页面
export const getDragLink = params => { return axios.get( '/channel/drag/get-drag-link',{params:params}).then(res => res) };
//商品分类
export const getCategoryList = params => { return axios.get( '/channel/category/get-category-list',{params:params}).then(res => res) };
//商品
export const getGoodList = params => { return axios.post( '/channel/good/get-good-list',params).then(res => res) };
//自定义页面
export const getCustomPageList = params => { return axios.get( '/channel/drag/get-custom-list',{params:params}).then(res => res) };

export const uploadVideo = params => { return axios.post( '/channel/drag/upload-voice',params).then(res => res) };



